package anonymous;

import rescuecore2.worldmodel.EntityID;
import rescuecore2.standard.entities.Area;
import rescuecore2.misc.Pair;

public class Task implements Comparable{
	public enum Competence  {FIREBRIGADE, POLICE, AMBULANCE};

	//global
	public EntityID eID;
	public Pair<Integer, Integer> location;

	//blockade
	public int cost;
	public Area area;

	//Fire
	public int fieryness;
	public int brokenness;
	public int temperature;
	public int importance;

	//Civil
	public int hp;
	public int damage;
	public int buriedness;

	Task(EntityID eid, Pair<Integer, Integer> location){
		this.eID = eid;
		this.location = location;
		this.cost=-1;
		this.area=null;
		this.fieryness=-1;
		this.brokenness=-1;
		this.temperature=-1;
		this.importance=-1;
		this.hp=-1;
		this.damage=-1;
		this.buriedness=-1;
	}
	Task(Task t){
		this.eID = t.eID;
		this.location = t.location;
		this.cost=-t.cost;
		this.area=t.area;
		this.fieryness=t.fieryness;
		this.brokenness=t.brokenness;
		this.temperature=t.temperature;
		this.importance=t.importance;
		this.hp=t.hp;
		this.damage=t.damage;
		this.buriedness=t.buriedness;
	}

	public boolean equals(Task t){
		//FIXME: that don't seems a good idea
		return (this.eID == t.eID);
	}

	public int compareTo(Object o){
		Task t = (Task)o;
		if(t.hp != -1){
			//ambulance tasks
			if( this.damage < t.damage)
				return -1;
			else if( this.damage == t.damage)
				return 0;
			else
				return 1;
		}
		else if(importance != -1){
			//firebrigade tasks
			if( this.fieryness < t.fieryness)
				return -1;
			else if( this.fieryness == t.fieryness )
				return 0;
			else
				return 1;
		}
		else if(cost != -1){
			//policial tasks
			if( this.cost < t.cost)
				return 1;
			else if( this.cost == t.cost)
				return 0;
			else
				return -1;
		}
		else
			return 0;
	}
}
